<script>
import {
	hash
} from 'crypto';
import {
	authDeeplink,
	authDecrypt,
	authGetSign,
	authDecryptSign,
	login
} from '@/api/index.js'


import {
	mapState,
	mapMutations
} from 'vuex';


// import FingerprintJS from '@fingerprintjs/fingerprintjs'


export default {
	data() {
		return {
			callAuthDecryptSign: false,
			appWgtVersion: ''
		}
	},
	computed: {
		...mapState("m_signature", ["signature"]),
	},
	methods: {
		...mapMutations("m_signature", ['setsignature']),
		// async  getVisitorId() {
		//   // 加载核心脚本
		//   const fp = await FingerprintJS.load()
		//   // 获取指纹结果
		//   const result = await fp.get()
		//   // 这就是稳定的访客 ID
		//   return result.visitorId
		// }
	},
	onLaunch() {
		console.log('app onLaunch');
	},
	onShow() {
		// uni.getSystemInfo({
		// 	success: function (res) {
		// 		console.log(res,'getSystemInfo')
		// 	}
		// });


		const isOldWebView = (() => {
			const ua = navigator.userAgent;
			console.log(ua, 'ua');
			const match = ua.match(/Chrome\/(\d+)/);
			return match && parseInt(match[1]) < 85;
		})();

		if (isOldWebView) {
			alert(
				'当前设备浏览器内核版本过低（低于 Chrome 85），可能导致钱包连接失败。请升级“Android 系统 WebView'
			);
		}

		let obj = uni.getSystemInfoSync()
		console.log(obj, 'obj');
		let getDeviceInfo = uni.getDeviceInfo()
		console.log(getDeviceInfo, 'getDeviceInfo')
		let deviceId = getDeviceInfo.deviceId
		let deviceModel = getDeviceInfo.deviceModel
		// console.log(deviceId, 'deviceId sssssssssssss');
		console.log(`${deviceId},${deviceModel},android`, '222222222');
		uni.setStorageSync('deviceId', `${deviceId},${deviceModel},android`)
		/* 17472379401172569861 */
		// uni.setStorageSync('deviceId',`${deviceId},A15,android`)
		// uni.setStorageSync('deviceId',`17472379401172569777,A15,android`)
		// 17464444061736328527
		console.log('app onShow');
		if (window?.solana?.isConnected == false && window?.solana?.publicKey == null) {
			console.log('未连接 请登录')
			uni.navigateTo({
				url: '/pages/loginOut/loginOut'
			})
			uni.setStorageSync('token', '');
			uni.setStorageSync('walletAddress', '');

		}
	},
	onHide: function () {
		console.log('App Hide')
	}
}
</script>

<style lang="scss">
/*每个页面公共css */
/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
@import "@/uni_modules/uview-ui/index.scss";


@import "uni_modules/ucs-css";

/* 动画css */
@import "node_modules/animate.css/animate.min.css";


.claimBox {
	padding-bottom: 20rpx;
}


.text-bold {
	font-weight: bold;
}

.text-white {
	color: #fff;
}

.text-black {
	color: #000;
}

.flex-column {
	flex-direction: column;
}

.items-center {
	align-items: center;
}

.justify-between {
	justify-content: space-between
}

.align-items-center {
	align-items: center;
}
</style>